﻿/*
 * Created by SharpDevelop.
 * User: Administrator
 * Date: 2016-2-16
 * Time: 10:05
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;

namespace WorkTimer
{
	/// <summary>
	/// Description of MainForm.
	/// </summary>
	public partial class MainForm : Form
	{
		public MainForm()
		{
			//
			// The InitializeComponent() call is required for Windows Forms designer support.
			//
			InitializeComponent();
			
			//
			// TODO: Add constructor code after the InitializeComponent() call.
			//
		}
		
		void MainFormLoad(object sender, EventArgs e)
		{
			this.Left = 0;
			this.Top = 0;
			this.Width = Screen.PrimaryScreen.Bounds.Width;
			this.Height = Screen.PrimaryScreen.Bounds.Height;
			tmMain.Start();
		}
		
		void TmMainTick(object sender, EventArgs e)
		{
			string numStr = btnClose.Text.Substring(5, btnClose.Text.Length - 6);
			int num = 0;
			int.TryParse(numStr, out num);
			num--;
			if (num <= 0)
			{
				btnClose.Text = "关闭窗口";
				btnClose.Enabled = true;
				tmMain.Stop();
			}
			else
			{
				btnClose.Text = "关闭窗口(" + num.ToString() + ")";
			}
		}
		
		void BtnCloseClick(object sender, EventArgs e)
		{
			this.Close();
		}
	}
}
